//
//  UCProgressViewSetting.swift
//  UICreate
//
//  Created by 范晓鑫 on 2021/10/27.
//

import UIKit

extension UCSetting where TargetType: UIProgressView {
    public static func progress(_ progress:Float) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.progress = progress
        })
    }
    public static func progress(image:UIImage) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.progressImage = image
        })
    }
    public static func style(_ style: UIProgressView.Style) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.progressViewStyle = style
        })
    }
    public static func progress(tint color: UIColor?) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.progressTintColor = color
        })
    }
    public static func track(image: UIImage?) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.trackImage = image
        })
    }
    public static func track(tint color: UIColor?) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.trackTintColor = color
        })
    }
    public static func observed(_ progress: Progress?) -> UCSetting<TargetType> {
        return .init(action: { (target) in
            target.observedProgress = progress
        })
    }
    
}
